package com.grape.springbootgradle20220520.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ElasticsearchConfiguration {
//    @Value("${elasticsearch.host}")
//    private String host;
//    @Value("${elasticsearch.host}")
//    private int port;
//    @Value("${elasticsearch.host}")
//    private int connTimeout;
//    @Value("${elasticsearch.host}")
//    private int socketTimeout;
//    @Value("${elasticsearch.host}")
//    private int connectionRequestTimeout;
//
//    @Bean(destroyMethod = "close",name = "client")
//    public RestHighLevelClient initRestClient() {
//        RestClientBuilder highClient = RestClient.builder(new HttpHost(host, port)).setRequestConfigCallback(
//                requestConfigBuilder ->
//                        requestConfigBuilder.setConnectionRequestTimeout(connectionRequestTimeout)
//                                .setConnectTimeout(connTimeout)
//                                .setSocketTimeout(socketTimeout)
//        );
//        return new RestHighLevelClient(highClient);
//    }
}
